package com.thoughtworks.impersonator.http.verify;

import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipelineCoverage;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
import org.jboss.netty.handler.codec.http.HttpResponse;

@ChannelPipelineCoverage("one")
public class VerifyMessageHandler extends SimpleChannelUpstreamHandler {
    private HttpResponse response;
    
    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
        response = (HttpResponse) e.getMessage();
        e.getChannel().disconnect();
    }
    
    public HttpResponse getResponse() {
        return response;
    }
}
